package com.abocode.aichat.util;

import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Properties;

/**
 * @author guanxf
 */
public class SystemUtils {
    private static String properties = "application.properties";

    public SystemUtils() {

    }

    public static String getProperty(String key) {
        String value = "";
        try (InputStream is = SystemUtils.class.getClassLoader().getResourceAsStream(
                properties)) {
            Properties p = new Properties();
            p.load(is);
            value = p.getProperty(key);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return value;
    }
    /**
     * 获取服务器相关信息
     *
     * @return
     */
    public static InetAddress getAddress() {
        InetAddress domain = null;
        try {
            domain = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
        }
        return domain;
    }
}
